<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>
<body>
	<p style="background:#0FC; color:#FFFFFF">
	<?php
	//$dbc=mysqli_connect('localhost','root','root','elvis_store')or die('Error connecting to MySQL server.');
	mysql_connect("localhost","root","root");
	mysql_select_db("elvis_store");
	mysql_query('set names "utf8"');
	
		if(!empty($_POST['submit'])){
			$email=$_POST['subject'];
			$first_name=$_POST['elvismail'];
			
			if(empty($email)&& empty($first_name)){
				echo '都是空的。<br/>';
			}
			if(empty($email)&& !empty($first_name)){
				echo 'email是空的<br/>First name:'.$first_name.'。<br/>';
			}
			if(!empty($email)&&empty($first_name)){
				echo 'email:'.$email.'<br/> First name 是空的.<br/>';
			}
			if(!empty($email)&&!empty($first_name)){
				
			
				echo $query =" insert into elvis_content (subject,email_content) values('$email','$first_name')";
					
				$rs=mysql_query($query);
				print_r($rs);
				if($rs){
				echo 'Customer added.';
				}
		}
			}
		else{
				$email='';
				$first_name='';
			}
	?>
    </p>
	<form method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>">
		<label for="subject">Sbuject of email:</label><br/>
        <input id="subject" name="subject" type="text" size="30" value="<?php echo $email; ?>" /><br/>
        <label for="elvismail">Body of email:</label><br/>
        <textarea id="evismail" name="elvismail" rows="8" cols="40" ><?php echo $first_name; ?></textarea><br/>
        <input type="submit" name="submit" value="submit" />
	</form>
    
</body>
</html>